package com.purchase.ml.service.email.dealer;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.purchase.ml.bean.req.mail.MailMessage;
import com.purchase.ml.consts.MailConstants;
import com.purchase.ml.entity.acc.SysUser;
import com.purchase.ml.entity.dealer.SysDealer;
import com.purchase.ml.mapper.dealer.SysDealerMapper;
import com.purchase.ml.mapper.sys.SysUserMapper;
import com.purchase.ml.security.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author :zxm
 * @date :2021/3/23 15:52
 * @description :经销商注册发送的邮件
 **/
@Component
public class CreateDealerEmail {

    @Value("${mail.content.generalEmail:123456@qq.com}")
    private String generalEmail;  // 寻求帮助的邮箱
    @Value("${mail.content.problemUrl:https://www.baidu.com/problemUrl}")
    private String problemUrl;   // 问题文档url
    @Value("${mail.content.verifyMail:https://www.baidu.com/verifyMail}")
    private String verifyMail;   // 校验邮箱的地址
    @Value("${mail.content.sysAddress:https://www.baidu.com/sysAddress}")
    private String sysAddress;   // 系统的地址
    @Value("${jwt.token.expire.time}")
    private Long tokenExpireTime;  // token过期时间

    @Autowired
    private SysUserMapper userMapper;
    @Autowired
    private SysDealerMapper sysDealerMapper;

    /**
     * 创建主经销商，发送给主经销商的邮件---主经销商已被批准 & 经销权付费
     * @param email  公司邮箱 / 用户邮箱
     * @param name  经销商名称 / 用户名称
     * @return
     */
    public MailMessage getMasterCreateMessage(String email, String name) {
        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject("Master Dealer Approval of Evo Oil Dealership System");
        mailMessage.setEmail(email);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ name +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Congratulations!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>You’ve been approved as a master dealer at Evo Oil Dealership System.<br />You have to complete the payment of dealership in order to continue to explore Evo Oil Dealership System.</span></div>\n" +
                "                <br /><br />\n" +
                "                <div id=\"btn\" style=\"position: absolute; width: 203px; height: 50px; left: 0px; top: 164px; overflow: visible;\">\n" +
                "                    <div id=\"Verify_Your_Email\" class=\"__web-inspector-hide-shortcut__\"><a href=\""+ sysAddress +"\" target=\"_blank\" rel=\"noopener noreferrer\"><button style=\"top: 622px; left: 500px; width: 203px; height: 50px; background: #FDB500 0% 0% no-repeat padding-box; text-align: center; border-radius: 30px; opacity: 1; font: normal normal bold 16px/19px Roboto; font-size: 16px; color: #ffffff;\">Payment for Dealership</button></a></div>\n" +
                "                </div>\n" +
                "                <br />\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 234px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />"+ problemUrl +"<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 432px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

    /**
     * 经销商申请，发送给经销商的邮件---电子邮件认证
     * @param email 经销商邮箱
     * @return
     */
    public MailMessage getDealerAuthMessage(String email) {
        // 此处需要用邮箱在账号表中查找
        SysUser sysUser = userMapper.selectByAccount(email);
        // 签发token
        String token = JwtUtil.sign(sysUser, tokenExpireTime);
        String oldUri = verifyMail + "?token="+token;
        String uri = oldUri.replaceAll("%20", "");
        LambdaQueryWrapper<SysDealer> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysDealer::getDealerId,sysUser.getDealerId());
        SysDealer dealer = sysDealerMapper.selectOne(wrapper);

        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject("Verify your email");
        mailMessage.setEmail(email);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ dealer.getDealerName() +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Welcome to Evo Oil Dealership System!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>You have registered as a dealer at Evo Oil Dealership System.<br />Click on the button below to confirm your email address to complete your registration.</span></div>\n" +
                "                <br /><br />\n" +
                "                <div id=\"btn\" style=\"position: absolute; width: 203px; height: 50px; left: 0px; top: 164px; overflow: visible;\">\n" +
                "                    <div id=\"Verify_Your_Email\" class=\"__web-inspector-hide-shortcut__\"><a href=\""+ uri +"\" target=\"_blank\" rel=\"noopener noreferrer\"><button style=\"top: 622px; left: 500px; width: 203px; height: 50px; background: #FDB500 0% 0% no-repeat padding-box; text-align: center; border-radius: 30px; opacity: 1; font: normal normal bold 16px/19px Roboto; font-size: 16px; color: #ffffff;\">Verify Your Email</button></a></div>\n" +
                "                </div>\n" +
                "                <br />\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 234px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />"+ problemUrl +"<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 432px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

    /**
     * 经销商认证电子邮件完毕，发送给经销商的邮件---注册完毕和待确认
     * @param email 公司邮箱 / 个人邮箱
     * @param name  经销商名称 / 账户名称
     * @return
     */
    public MailMessage getDealerNotifyMessage(String email,String name) {
        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject("Registration Completed");
        mailMessage.setEmail(email);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ name +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Welcome to Evo Oil Dealership System!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>You have completed the registration at Evo Oil Dealership System.<br />Please wait for further notice as you are currently under status of pending for approval.</span></div>\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 150px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />"+ problemUrl +"<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 350px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

    /**
     * 经销商认证电子邮件完毕，发送给主经销商的邮件---新经销商注册通知
     * @param emailAddress
     * @param mName
     * @param name
     * @return
     */
    public MailMessage getMdealerNotifyMessage(String emailAddress,String mName, String name) {
        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject(" Pending of Dealer Registration Verification");
        mailMessage.setEmail(emailAddress);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ mName +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Welcome to Evo Oil Dealership System!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Dealer [ "+ name +" ] has registered at Evo Oil Dealership System.<br />You may verify dealer [ "+ name +" ] after ensuring the details of dealer [ "+ name +" ].</span></div>\n" +
                "                <br /><br />\n" +
                "                <div id=\"btn\" style=\"position: absolute; width: 203px; height: 50px; left: 0px; top: 164px; overflow: visible;\">\n" +
                "                    <div id=\"Verify_Your_Email\" class=\"__web-inspector-hide-shortcut__\"><a href=\""+ sysAddress +"\" target=\"_blank\" rel=\"noopener noreferrer\"><button style=\"top: 622px; left: 500px; width: 203px; height: 50px; background: #FDB500 0% 0% no-repeat padding-box; text-align: center; border-radius: 30px; opacity: 1; font: normal normal bold 16px/19px Roboto; font-size: 16px; color: #ffffff;\">[Go To System]</button></a></div>\n" +
                "                </div>\n" +
                "                <br />\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 234px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />problemUrl<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 432px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

    /**
     * 主经销商认证经销商，发送给owner的邮件---经销商已被认证
     * @param emailAddress
     * @param agentName
     * @param mDealerName
     * @param dealerName
     * @return
     */
    public MailMessage getMdealerHandleMessage(String emailAddress,String agentName,String mDealerName,String dealerName) {
        // 邮件中按钮路由到owner的系统
        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject("Pending of Dealer Registration Approval");
        mailMessage.setEmail(emailAddress);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ agentName +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Welcome to Evo Oil Dealership System!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Master Dealer [ "+ mDealerName +" ] has verified dealer [ "+ dealerName+" ] at Evo Oil Dealership System.<br />You may approve dealer [ "+ dealerName +" ] after ensuring the details of dealer [ "+ dealerName +" ].</span></div>\n" +
                "\n" +
                "                <div id=\"btn\" style=\"position: absolute; width: 203px; height: 50px; left: 0px; top: 164px; overflow: visible;\">\n" +
                "                    <div id=\"Verify_Your_Email\" class=\"__web-inspector-hide-shortcut__\"><a href=\""+ sysAddress +"\" target=\"_blank\" rel=\"noopener noreferrer\"><button style=\"top: 622px; left: 500px; width: 203px; height: 50px; background: #FDB500 0% 0% no-repeat padding-box; text-align: center; border-radius: 30px; opacity: 1; font: normal normal bold 16px/19px Roboto; font-size: 16px; color: #ffffff;\">[Go To System]</button></a></div>\n" +
                "                </div>\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 234px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />problemUrl<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 432px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

    /**
     * 当持有者批准该经销商后，发送给经销商的邮件---用户已被批准 & 经销权付费
     * @param emailAddress
     * @param dealerName
     * @return
     */
    public MailMessage getPassNotifyMessage(String emailAddress, String dealerName) {
        MailMessage mailMessage = new MailMessage();
        mailMessage.setSubject("Dealer Approval of Evo Oil Dealership System Registration");
        mailMessage.setEmail(emailAddress);
        String content = "<div id=\"editbody1\">\n" +
                "    <div style=\"font-size: 10pt; font-family: Verdana,Geneva,sans-serif;\">\n" +
                "        <div id=\"Evo_Oil_Email_Template_web_guide\" style=\"position: absolute; width: 1032px; height: 1080px; background-color: rgba(255, 255, 255, 1); overflow: hidden; --web-view-name: Evo Oil Email Template_web_guide; --web-view-id: Evo_Oil_Email_Template_web_guide; --web-scale-on-resize: true; --web-enable-deep-linking: true;\">\n" +
                "            <div id=\"header\" style=\"text-align: center;\"><img id=\"evo_oil_logo\" style=\"position: absolute; width: 94.26px; height: 86px; left: 44.5%; top: 23px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/evo_oil_logo.png\" /></div>\n" +
                "            <img id=\"img_login\" style=\"position: absolute; width: 812px; height: 272px; left: 9.7%; top: 136px; overflow: visible;\" src=\"http://res.evooil.com.my/static/images/img_home_banner.jpg\" />\n" +
                "            <div id=\"email_content\" style=\"position: absolute; width: 536px; height: 473px; left: 12%; top: 458px; overflow: visible;\"><br /><br />\n" +
                "                <div id=\"Hello__name_\" style=\"left: 0px; top: 0px; position: absolute; overflow: visible; width: 114px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Hello "+ dealerName +",</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"Welcome_to_Evo_Oil_Dealership_\" style=\"left: 0px; top: 41px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: bold; font-size: 24px; color: rgba(112, 112, 112, 1);\"><span>Congratulations!</span></div>\n" +
                "                <br />\n" +
                "                <div id=\"You_have_registered_as_a_deale\" style=\"left: 0px; top: 81px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>You’ve been approved as a dealer at Evo Oil Dealership System.<br />You have to complete the payment of dealership in order to continue to explore the Evo Oil Dealership System.</span></div>\n" +
                "                <br /><br />\n" +
                "                <div id=\"btn\" style=\"position: absolute; width: 203px; height: 50px; left: 0px; top: 164px; overflow: visible;\">\n" +
                "                    <div id=\"Verify_Your_Email\" class=\"__web-inspector-hide-shortcut__\"><a href=\""+ sysAddress +"\" target=\"_blank\" rel=\"noopener noreferrer\"><button style=\"top: 622px; left: 500px; width: 203px; height: 50px; background: #FDB500 0% 0% no-repeat padding-box; text-align: center; border-radius: 30px; opacity: 1; font: normal normal bold 16px/19px Roboto; font-size: 16px; color: #ffffff;\">Payment for Dealership</button></a></div>\n" +
                "                </div>\n" +
                "                <br />\n" +
                "                <div id=\"If_you_have_problems_please_co\" style=\"left: 0px; top: 234px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>If you have problems, please copy and paste the below URL into your web browser. <br /><br />"+ problemUrl +"<br /><br />Need help? Contact us at <a href=\"mailto:careline@evooil.com.my\">"+ generalEmail +"</a> <br /><br />Thank you.</span></div>\n" +
                "                <br /><br /><br /><br />\n" +
                "                <div id=\"Best_Regards_Evo_Oil_Dealershi\" style=\"left: 0px; top: 432px; position: absolute; overflow: visible; width: 537px; white-space: nowrap; line-height: 20px; margin-top: -1px; text-align: left; font-family: Roboto; font-style: normal; font-weight: normal; font-size: 18px; color: rgba(112, 112, 112, 1);\"><span>Best Regards,</span><br /><span style=\"font-style: normal; font-weight: bold;\">Evo Oil Dealership System</span></div>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>";
        mailMessage.setText(content);
        mailMessage.setType(MailConstants.INFO_TYPE);
        return mailMessage;
    }

}
